home *** CD-ROM | disk | FTP | other *** search
Text File | 1989-10-25 | 1.2 KB | 43 lines | [TEXT/GEOL] |
- Item 6369948 25-Oct-89 08:29
-
- From: CDA0004 VAR Shana Enterprises, Don Murphy
-
- To: D2086 Efficient Field Svc, C Faith,PRT
-
- cc: MACAPP.TECH$ MACAPP Tech
-
- Sub: Re- File Filter Methods
-
- Curtis,
-
- A method can't be a fileFilter under normal circumstances. You can't take the
- address of a method since you won't know which implementation to use until run
- time, when you can see what the class of the object is.
-
- This goes back to the discussion some time ago about compile time vs. run time
- typing (is it a TObject, a TMammal, or a TDog?).
-
- You can make up a "plain Pascal" procedure to be you file filter, and just pass
- the buck to a method of a global object:
-
- VAR
- gMyObject : TMyObject;
-
-
- FUNCTION FilterGlue (pb : ParamBlkPtr) : Boolean;
- BEGIN
- FilterGlue := gMyObject.FileFilter (pb);
- END;
-
-
- Easy. You can encapsulate the whole thing in a Unit, hiding both the global
- and the FilterGlue procedure, and preserve your OO pride. And it keeps the
- method dispatcher involved, so no worries about possible future OVERRIDES and
- re-use of your code.
-
- Regards,
-
- Wayne Malkin
-
-
-